package com.monicash.monicash.widge;

import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * @ProjectName: ZhiLiProject
 * @Package: com.xx.text.widget
 * @ClassName: MyWebView
 * @Author: ANWEN
 * @CreateDate: 12/16/23 12:01 PM
 * @UpdateUser:
 * @UpdateDate: 12/16/23 12:01 PM
 * @UpdateRemark:
 * @Version:
 */
public class NewWebView extends WebView {

    public NewWebView(@NonNull Context context) {
        super(context);
    }

    public NewWebView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public NewWebView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
    ScrollInterface web;

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
        try {
            if (web != null) {
                web.onSChanged(l, t, oldl, oldt);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public void setOnNewWebViewScroolChangeListener(ScrollInterface t){
        this.web=t;
        this.web = t;
    }

    public interface ScrollInterface {
        public void onSChanged(int l, int t, int oldl, int oldt) ;

    }
}
